package chexuan.game.interfaces.service;

import java.io.IOException;
import java.nio.channels.SocketChannel;

import chexuan.game.bean.packet.common.Packet;
import chexuan.game.exception.CmdRegisteredException;
import chexuan.game.exception.NotRegisteredCmdException;
import chexuan.game.interfaces.io.connection.AbstractSocketConnection;
import chexuan.game.interfaces.packet.InterfacePacket;

public interface InterfaceIOService extends InterfaceService {

	public Class<? extends InterfacePacket> getCmdPacketClass(int cmd)
			throws NotRegisteredCmdException;

	public void registerCmdPacket(int cmd,
			Class<? extends InterfacePacket> packetClass)
			throws CmdRegisteredException;

	public void sendPacket(AbstractSocketConnection connection,
			InterfacePacket packet);

	public void createSocketConnection(SocketChannel channel);

	public int getConnectionId(SocketChannel channel);

	public void sendPacket(int connectionId, Packet packet) throws IOException;
}
